/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author DomKvic
 */
public class MD5 {
    public static String maHoa(String text){
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            md5.update(text.getBytes());
            BigInteger bis = new BigInteger(1, md5.digest());
            return bis.toString(64);
        } catch (NoSuchAlgorithmException ex) {
            System.out.println("khong the ma hoa duoc:" + ex.getMessage());
        }
        return "";
    }
}
